﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordFields
    {
        public WordField this[int index]
        {
            get { return new WordField(_fields[index]); }
        }

        private Fields _fields;

        internal WordFields(Fields fields)
        {
            _fields = fields;
        }

        public WordField Add(WordRange range, FieldType type = FieldType.wdFieldEmpty, string text = null, bool preserveFormatting = true)
        {
            Field field = _fields.Add(range._range, type, text, preserveFormatting);
            return new WordField(field);
        }
    }
}
